<template>
	<el-main>
	<div style="text-align: center;font-weight: 600;font-size: 16px">
		{{ form.title }}
	</div>
	<el-main>
		<div style="margin:20px 0px 20px 0px">
			<div style="display: inline-block">日志日期:{{form.diaryDay}}</div>
			<div style="display: inline-block;float: right;">日志类型:
				<el-tag v-if="form.diaryType=='1'">工作日志</el-tag>
				<el-tag v-if="form.diaryType=='2'">个人日志</el-tag>
			</div>
		</div>
		<div>
			<div v-html="form.content"></div>
		</div>
		<el-form-item label="相关附件" v-if="form.attachId!=undefined&&form.attachId!=''" style="margin-top:20px;">
			<attach-menu :attachIds="form.attachId" :roleFlag="form.attachRole" :preview="true"></attach-menu>
		</el-form-item>
			<div style="width: 100%;">
				<el-avatar :src="form.avatar" size="small" style="margin-top: 5px;"></el-avatar>
				<span style="position: absolute;margin-left: 15px;    line-height: 30px;">{{form.userName}}</span>
				<span style="float: right">
					<div>
						<el-icon style="margin-right: 10px;    padding-top: 10px;"><el-icon-clock/></el-icon>{{form.createTime}}
					</div>
				</span>
			</div>
	</el-main>
	</el-main>
</template>
<script>
export default {
	name: 'Diary Details',
	data() {
		return {
			form: {
				diaryId: this.$route.query.diaryId,
				title: '',
				diaryDay: '',
				diaryType: '1',
				content: '',
				attachId: '',
				attachRole: '1',
				msgType: '',
				createTime:"",
				userName:"",
				avatar:"",
			},
		}
	},
	mounted() {
		this.getMyDiaryById();
	},
	methods: {
		async getMyDiaryById()
		{
			let res = await this.$API.office.diary.getMyDiaryById.get({diaryId:this.form.diaryId});
			{
				if(res.code==200)
				{
					this.form.diaryId=res.data.diaryId
					this.form.title =res.data.title
					this.form.diaryDay=res.data.diaryDay
					this.form.content = res.data.content
					this.form.diaryType = res.data.diaryType
					this.form.attachId=res.data.attachId
					this.form.attachRole=res.data.attachRole
					this.form.userName = res.data.userName
					this.form.avatar = res.data.avatar
					this.form.createTime = res.data.createTime;
				}else
				{
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}
	}

}
</script>

<style>
</style>
